package com.example.spring.ioc.base;

import lombok.Data;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * @author lei yu
 * @date 2024/05/15
 */
@Data
public class Person implements InitializingBean, DisposableBean {

    private Integer id;
    private String name;
    private String gender;
    private LocalDate birthday;
    private List<String> hobbies;
    private Map<Integer,String> course;
    private Wife wife;

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("实例化Person1");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("销毁Person1");
    }

    public void initByConfig() throws Exception {
        System.out.println("实例化Person2");
    }

    public void destroyByConfig() throws Exception {
        System.out.println("销毁Person2");
    }
}
